using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

//[DefaultExecutionOrder(1)]
[RequireComponent(typeof(ItemGrid))]
public class GridInteract : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
    InventoryController inventoryController;
    ItemGrid itemGrid;
    private void Awake()
    {
        GameObject tarObject = GameObject.Find("inventorycontroller");
        inventoryController = tarObject.GetComponent<InventoryController>();
        //inventoryController=InventoryController.instance;
        itemGrid = GetComponent<ItemGrid>();
    }

    void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData)
    {
     
        inventoryController.SelectedItemGrid = itemGrid;
    }

    void IPointerExitHandler.OnPointerExit(PointerEventData eventData)
    {
        //Debug.Log(itemGrid.name+"exit");
        inventoryController.SelectedItemGrid = null;
    }
}
